package atag.runtime.ln.nodeAttributes.dynamic;

import atag.runtime.ln.nodeAttributes.BooleanAttribute;
import atag.runtime.ln.nodeAttributes.dynamic.BooleanProvider;

/**
 * Defines an boolean attribute whose value is dynamically derived.
 *
 */
public class DynamicBooleanAttribute extends BooleanAttribute {


	/**
	 * Creates a new instance of this attribute.
	 * 
	 * @param key the name of the attribute
	 * @param provider an object used to derive the value associated dynamically.
	 */
	public DynamicBooleanAttribute(String key, BooleanProvider provider) {

		this.key = key;
		this.value = provider;
	}
	
	/**
	 * @see polimi.ln.nodeAttributes.NodeAttribute#getValue()
	 */
	public Object getValue() {
		return new Boolean(((BooleanProvider)value).getValue());
	}

	public String toString() {

		return "DynamicBooleanAttribute key = " + key + ", value = " + value;
	}
}
